<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>18</title>
    <script src="jQuery/jquery-3.4.1.js"></script>
    <script>
         $(function () {
                var btn=document.getElementsByTagName("button")[0];
                btn.onclick=function () {
                    var input=document.getElementsByTagName("input")[0];
                    var text=input.value;
                    $("img").attr("src",text);
                }
         })
    </script>
</head>
<body>
<input type="text">
<button>切换</button><br>
<img src="https://ossgw.alicdn.com/alp/1572809375526-200-76.png" alt="">
</body>
</html>